package thread;
/*
 sleep要求必须捕获处理中断异常  InteruptedException
 */
public class SleepDemo2 {
    public static void main(String[] args) {
        Thread lin = new Thread(){
            public void run(){
                System.out.println("睡觉");
                try {
                    Thread.sleep(5000000);
                } catch (InterruptedException e) {
                    System.out.println("干嘛呢！干嘛呢！干嘛呢！");

                }
                System.out.println("醒了");
            }
        };

        Thread huang = new Thread(){
            public void run(){
                System.out.println("大锤80，小锤40");


                try {
                    for (int i = 0; i < 5; i++) {
                        System.out.println("80！");
                    Thread.sleep(3000);}
                    System.out.println("大哥！ 搞定！");
                    lin.interrupt();

                } catch (InterruptedException e) {
                    System.out.println("哎吗  吓死了");
                }

            }
        };
        lin.start();
        huang.start();

    }
}
